var express = require('express');
var router = express.Router();
var path = require("path");

// 获取验证模块
var authorization = require(path.join(process.cwd(),"/modules/authorization"));

// 通过验证模块获取类别
var groupServ = authorization.getService("GroupService");

// 通过参数方式查询静态参数还是动态参数
router.get("/userid",
	// 业务逻辑
	function(req,res,next) {
		// attrServ
		groupServ.getGroupUserID(function(err,groups){
			if(err) return res.sendResult(null,400,err);
			res.sendResult(groups,200,"获取成功");
		})(req,res,next);
	}
);


router.get("/zhuangtai",
	// 业务逻辑
	function(req,res,next) {
		// attrServ
		groupServ.getGroupZhuangTai(function(err,groups){
			if(err) return res.sendResult(null,400,err);
			res.sendResult(groups,200,"获取成功");
		})(req,res,next);
	}
);


router.get("/danwei",
	// 业务逻辑
	function(req,res,next) {
		// attrServ
		groupServ.getGroupDanWei(function(err,groups){
			if(err) return res.sendResult(null,400,err);
			res.sendResult(groups,200,"获取成功");
		})(req,res,next);
	}
);


router.get("/zhizaoshang",
	// 业务逻辑
	function(req,res,next) {
		// attrServ
		groupServ.getGroupZhiZaoShang(function(err,groups){
			if(err) return res.sendResult(null,400,err);
			res.sendResult(groups,200,"获取成功");
		})(req,res,next);
	}
);



module.exports = router;
